<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <!--{include file='comm/header.tpl'}-->
    <title>漏操作订单审核</title>
    <!--{include file='comm/comm_cal.tpl'}-->
    <!--{include file="comm/comm_multiselect.tpl"}-->
    <script src="/quanliadmin/docroot/js/createreoprt.js"></script>
</head>
<body>

<div class="container">
    
        <div class="comm_content">

            <div class="search-box">
                <div style="position:relative">
                    <form method="post" class="form-inline"  id="search_form" action="/quanliadmin/app/send/orderPrint.pscript?operFlg=2" target="_blank">
                        <table>
                            <tbody>
                            <tr>
                                <td height="27px">
                                    <span>订单编号：<input type="text" class="form-control input-sm" style="width:110px" value="" name="bill_code" id="bill_code"></span>

                                    <span>
                                       漏操作流程：<select id="forget_operate_flow" name="forget_operate_flow" class="form-control input-sm" style="width:120px;">
                                            <option value="" selected="">请选择</option>
                                            <option value="1" >上车扫描</option>
                                            <option value="2" >质检入库、上车扫描</option>　　
                                        </select>
                                    </span>

                                    <span>配送日期：<input type="text" class="form-control input-sm" readonly style="width:90px" value="<!--{$currentDate|default:''}-->" name="send_date" id="send_date"></span>
                                    <button type="button" class="btn btn-default btn-sm" onclick="bill_goods.timeClear();">清 空</button>

                                    <span>
                                       配送城市：<select id="cityID" name="cityID" class="form-control input-sm" style="width:100px;">
                                            <option value="" selected="">请选择</option>                                            　　
                                        </select>
                                    </span>

                                    <span>
                                        配送站：
                                        <select name="distribution_id" id="distribution_id" class="form-control input-sm" style="width:100px;">
                                            <option value="">请选择</option>
                                        </select>
                                    </span>

                                    <span><input type="button" onclick="bill_goods.search();" class="btn btn-primary" value="查询"></span>
                                    <span><input type="button" onclick="bill_goods.clear();" class="btn btn-warning" value="重置"></span>

                                </td>
                            </tr>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>

            <table id="flex" style="display:none;"></table>

        </div>


</div>
<script type="text/javascript">

$('#send_date').datepicker();

$("#flex").flexigrid({
    url:"/invokingAjax-backend/send/billGoodsOperateForget.ajax?operFlg=1",
    dataType: "json",
    colModel : [
        {display: "操作", width : 100, align: "center"},
        {display: "订单编号", width : 140, align: "center"},
        {display: "漏操作流程", width : 180},
        {display: "配送站", width : 150,name:'distribution_id',sortable : true},
        {display: "到货日期", width : 100, align: "center",name : "createTime", sortable : true},
        {display: "操作记录", width : 360},
        {display: "操作人员", width : 120},
        {display: "操作时间", width : 140,name : "createTime", sortable : true}

    ],

    sortname: "createTime,distribution_id",
    sortorder: "desc",
    usepager: true,
    rp: 50,
    useRp: true,
    showTableToggleBtn: true,
    onSubmit: function() {
        var dt = $('#search_form').serializeArray();
        $("#flex").flexOptions({params: dt});
        return true;
    }
});

var bill_goods = {

    //头部 按条件查询
    search: function() {
        var dt = $('#search_form').serializeArray();
        $("#flex").flexOptions({params: dt}).flexReload();
    },

    //重置
    clear: function(){
        document.forms['search_form'].reset();
        this.search();
    },

    timeClear: function() {
        $('#send_date').val('');
    },

    //重新加载
    load: function() {
        $("#flex").flexReload();
    },

    //订单详情
    billview: function( bill_no ) {
        window.open('/quanliadmin/app/bill/billSearch.pscript?operFlg=9&bill_no=' + bill_no);
    },

    //审核订单商品
    checkGoods:function( bill_goods_no ,forget_operate_flow){

        E.ajax_post({
            url: "/invokingAjax-backend/send/billGoodsOperateForget.ajax?operFlg=2",
            data: {
                bill_goods_no:bill_goods_no,
                forget_operate_flow:forget_operate_flow
            },
            call: function( o ){
                if(o.code == 200){
                    E.alert(o.message,2);
                    bill_goods.load();
                }else{
                    E.alert(o.message);
                }
            }
        });
    }

};

$(window).ready(function() {

    $("#cityID").html("");

    var cityHtml = '<option value="">请选择</option>';

    $.ajax({
        type: "post",
        url: "/invokingAjax-comm/bill/distribution.ajax?operFlg=1",
        dataType: "json",
        data: "",
        success: function( result_obj ) {
            if(result_obj.code == 200){
                $.each(result_obj.data, function(i,val){
                    cityHtml +='<option value="'+val.id+'">'+val.name+'</option>';
                });
                $('#cityID').html(cityHtml);
            }else{
                E.alert(result_obj.message);
            }
        }
    });

    //点击城市联动获得配送站(联动)
    $(document).on('change', '#cityID', function() {

        $('#distribution_id').html("");

        var cityID = $('#cityID').children('option:selected').val();
        var distributionHtml = '<option value="">请选择</option>';
        E.ajax_post({
            url: "/invokingAjax-comm/bill/distribution.ajax?operFlg=2",
            data: {deliver_cityid: cityID},
            call: function( obj ) {
                if(obj.code ==200 && obj.data != null){

                    $.each(obj.data, function(i,val){
                        distributionHtml +='<option value="'+val.distribution_id+'">'+val.distribution_name+'</option>';
                    });
                    $('#distribution_id').html(distributionHtml);
                }else{

                    distributionHtml += '';
                    $('#distribution_id').html(distributionHtml);
                }
            }
        });
    });
});
</script>

</body>
</html>